package com.ingsha.prometheus.entity;


import java.io.Serializable;
import java.time.LocalDateTime;

public class Result<T> implements Serializable {
    private int code;
    private String msg;
    private T data;
    private LocalDateTime time;


    public Result() {

    }

    public Result(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }


    public Result success() {
        this.code = 200;
        return this;
    }

    public Result(int code, String msg, T data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

    public int getCode() {
        return code;
    }

    public Result<T> setCode(int code) {
        this.code = code;
        return this;
    }

    public String getMsg() {
        return msg;
    }

    public Result<T> setMsg(String msg) {
        this.msg = msg;
        return this;
    }

    public T getData() {
        return data;
    }

    public Result<T> setData(T data) {
        this.data = data;
        return this;
    }

    public LocalDateTime getTime() {
        return time;
    }

    public void setTime(LocalDateTime time) {
        this.time = time;
    }

    @Override
    public String toString() {
        return "Result{" +
                "code=" + code +
                ", msg='" + msg + '\'' +
                '}';
    }
}